# Create your models here.
from functools import partial

from django.db import models

from apps.vadmin.analysis.utils import generate_timestamp_string
from apps.vadmin.op_drf.models import CoreModel

default_for_batch = partial(generate_timestamp_string, prefix = "BATCH")


class Batch(CoreModel):
    ANALYSIS_PLAN_CHOICES = (
        (0, "等待上传信息表"),
        (1, "分析未开始"),
        (2, "分析中"),
        (3, "分析完成"),
        (4, "分析失败")
    )

    batch_num = models.CharField(
        verbose_name = '批次号', max_length = 32, default = default_for_batch,
        editable = False, help_text = '批次号')
    batch_name = models.CharField(
        verbose_name = "批次名称", max_length = 32, null = True, blank = True,
        help_text = "批次名称")
    batch_info = models.TextField(
        verbose_name = '批次描述', null = True, blank = True, help_text = '批次描述')
    analysis_plan = models.PositiveSmallIntegerField(
        verbose_name = '分析进度', default = 0, blank = True,
        choices = ANALYSIS_PLAN_CHOICES, help_text = '分析进度')
    plan_explain = models.CharField(
        verbose_name = '分析状态', max_length = 128, null = True,
        blank = True, help_text = '分析状态')
    deplane_data_path = models.CharField(
        verbose_name = '数据分析路径', max_length = 256, null = True,
        blank = True, help_text = '数据分析路径')
    pooling_name = models.CharField(
        verbose_name = '已上传信息表', max_length = 128, null = True,
        blank = True, help_text = '已上传信息表')

    mhc = models.CharField(
        verbose_name = "MHC亚型" , max_length = 32 , null = True , blank = True ,
        help_text = "MHC亚型" )
    neoantigens = models.CharField(
        verbose_name = "新抗原" , max_length = 32 , null = True , blank = True ,
        help_text = "新抗原" )
    protein_info = models.CharField(
        verbose_name = "蛋白信息" , max_length = 64 , null = True , blank = True ,
        help_text = "蛋白信息" )
    protein_seq = models.CharField(
        verbose_name = "蛋白序列" , max_length = 256 , null = True , blank = True ,
        help_text = "蛋白序列" )
    remark = models.CharField(max_length=256,verbose_name="备注", null=True, blank=True)
    class Meta:
        verbose_name = verbose_name_plural = '批次信息'
